
#pragma once

#include <boost/asio.hpp>
#include <atomic>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <cstdint>
#include <cstring>
#include <map>
#include <memory>

class Session;

class HttpServer
{
public:
	HttpServer(boost::asio::io_context & io_context);
	void AcceptConnection();
	void RemoveSession(std::int64_t id);
private:
	boost::asio::io_context & m_context;
	boost::asio::ip::tcp::acceptor m_acceptor;
	boost::asio::ip::tcp::socket   m_socket;
private:
	std::atomic<int64_t> m_id{0};
	std::map<int64_t, std::shared_ptr<Session>> m_session_map;
};